﻿<Window x:Class="CapstoneProjectAEReader.GUIs.Others.Exist"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Height="680" Width="600" ResizeMode="NoResize"
        Closed="Window_Closed" Title="Edit Note" Icon="pack://application:,,,/EditNote.ico">
    <Window.Resources>
        <DataTemplate x:Key="listBoxTemplate">
            <Border BorderBrush="LightGray" BorderThickness="1" CornerRadius="10">
                <StackPanel Margin="3">
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*" />
                            <ColumnDefinition Width="0.5*" />
                        </Grid.ColumnDefinitions>
                        <Border BorderBrush="LightGray" BorderThickness="0,0,1,1" Grid.Column="0">
                            <TextBlock FontWeight="Bold" Text="{Binding EbookTitle}" DockPanel.Dock="Left" Margin="2"
                                       Foreground="Green" />
                        </Border>
                        <Border BorderBrush="LightGray" BorderThickness="0,0,0,1" Grid.Column="1">
                            <TextBlock Text="{Binding Date}" DockPanel.Dock="Right" HorizontalAlignment="Right"
                                       FontWeight="SemiBold" Margin="2" Foreground="Blue" />
                        </Border>
                    </Grid>
                    <DockPanel>
                        <TextBlock Text="{Binding PageNumber}" FontSize="10" Margin="0,0,10,4"
                                   HorizontalAlignment="Right" DockPanel.Dock="Bottom" />
                        <TextBlock Text="{Binding Description}" TextWrapping="Wrap" Height="34"
                                   TextTrimming="CharacterEllipsis" Margin="2" />
                    </DockPanel>
                </StackPanel>
            </Border>
        </DataTemplate>

        <DataTemplate x:Key="ListAllNoteOfBook">
            <Grid Background="White" Margin="0,6,0,2">
                <Border BorderThickness="2" CornerRadius="10">
                    <Border.BorderBrush>
                        <SolidColorBrush Color="Gray" Opacity="0.7" />
                    </Border.BorderBrush>
                    <DockPanel Margin="3">
                        <Border BorderBrush="LightGray" BorderThickness="0,0,0,1" DockPanel.Dock="Top">
                            <Grid>
                                <TextBlock FontWeight="Bold" Text="{Binding NotedWord}" Padding="3" Foreground="Green" />
                                <TextBlock FontWeight="SemiBold" Text="{Binding PageNo}" Padding="3"
                                           HorizontalAlignment="Right" Foreground="LightCoral" />
                            </Grid>
                        </Border>
                        <Grid DockPanel.Dock="Top">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="*" />
                                <ColumnDefinition Width="*" />
                            </Grid.ColumnDefinitions>
                            <Border BorderBrush="LightGray" BorderThickness="0,0,1,1" Grid.Column="0">
                                <TextBlock FontWeight="SemiBold" Text="{Binding EbookTitle}" Padding="3"
                                           Foreground="DarkRed" />
                            </Border>
                            <Border BorderBrush="LightGray" BorderThickness="0,0,0,1" Grid.Column="1">
                                <TextBlock Text="{Binding Date}" HorizontalAlignment="Right" Padding="3"
                                           Foreground="Orange" />
                            </Border>
                        </Grid>
                        <TextBlock Text="{Binding Description}" TextWrapping="Wrap" Height="34"
                                   TextTrimming="CharacterEllipsis" Padding="3" DockPanel.Dock="Top" />
                    </DockPanel>
                </Border>
            </Grid>
        </DataTemplate>
        <Style x:Key="MainBorderStyle" TargetType="{x:Type Border}">
            <Setter Property="Background">
                <Setter.Value>
                    <LinearGradientBrush StartPoint="0,0" EndPoint="1,1">
                        <GradientStop Color="Yellow" Offset="0.0" />
                        <GradientStop Color="Red" Offset="0.25" />
                        <GradientStop Color="Blue" Offset="0.75" />
                        <GradientStop Color="LimeGreen" Offset="1.0" />
                    </LinearGradientBrush>
                </Setter.Value>
            </Setter>
            <Setter Property="BorderBrush" Value="LightGray" />
            <Setter Property="BorderThickness" Value="1" />
            <Setter Property="CornerRadius" Value="5" />
            <Setter Property="SnapsToDevicePixels" Value="True" />
        </Style>
    </Window.Resources>

    <Border BorderBrush="LightBlue" BorderThickness="2" Padding="10">
        <Border.Background>
            <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
                <GradientStop Color="#FFC4E3FF" Offset="0" />
                <GradientStop Color="#FFC1EDFF" Offset="1" />
            </LinearGradientBrush>
        </Border.Background>
        <StackPanel>
            <Border BorderBrush="Transparent" BorderThickness="1" CornerRadius="2">
                <Border.Background>
                    <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1" Opacity="0.9">
                        <GradientStop Color="White" Offset="0" />
                        <GradientStop Color="WhiteSmoke" Offset="0.5" />
                        <GradientStop Color="White" Offset="1" />
                    </LinearGradientBrush>
                </Border.Background>
                <Border.OpacityMask>
                    <LinearGradientBrush>
                        <GradientStop Color="Transparent" Offset="0" />
                        <GradientStop Color="Black" Offset="0.4" />
                        <GradientStop Color="Black" Offset="0.6" />
                        <GradientStop Color="Transparent" Offset="1" />
                    </LinearGradientBrush>
                </Border.OpacityMask>
                <Label x:Name="lbNoteWord" Foreground="Green" FontWeight="SemiBold" Height="34"
                       HorizontalContentAlignment="Center" />
            </Border>
            <ListView Height="250" HorizontalAlignment="Stretch" BorderBrush="BlanchedAlmond" BorderThickness="2"
                      x:Name="noteListBox" HorizontalContentAlignment="Center" Margin="0,8,0,8"
                      ScrollViewer.VerticalScrollBarVisibility="Visible" ScrollViewer.HorizontalScrollBarVisibility="Disabled"
                      SelectionChanged="noteListBox_SelectionChanged">
                <ListView.ItemContainerStyle>
                    <Style TargetType="{x:Type ListBoxItem}">
                        <Setter Property="FontSize" Value="12" />
                        <Setter Property="HorizontalContentAlignment" Value="Left" />
                    </Style>
                </ListView.ItemContainerStyle>
                <ListView.View>
                    <GridView>
                        <GridViewColumn Width="150" x:Name="firstColumn">
                            <GridViewColumn.CellTemplate>
                                <DataTemplate>
                                    <TextBlock Text="{Binding FirstColumn, StringFormat=\{0:C\}}"
                                               HorizontalAlignment="Left" FontWeight="SemiBold" Foreground="DarkRed" />
                                </DataTemplate>
                            </GridViewColumn.CellTemplate>
                        </GridViewColumn>
                        <GridViewColumn Width="50" x:Name="secondColumn">
                            <GridViewColumn.CellTemplate>
                                <DataTemplate>
                                    <TextBlock Text="{Binding SecondColumn, StringFormat=\{0:C\}}"
                                               HorizontalAlignment="Center" Foreground="LightSlateGray" />
                                </DataTemplate>
                            </GridViewColumn.CellTemplate>
                        </GridViewColumn>
                        <GridViewColumn Width="400" x:Name="thirdColumn">
                            <GridViewColumn.CellTemplate>
                                <DataTemplate>
                                    <TextBlock Text="{Binding ThirdColumn, StringFormat=\{0:C\}}"
                                               HorizontalAlignment="Left" Height="40" FontSize="12" Foreground="Black" TextWrapping="Wrap"
                                               TextTrimming="CharacterEllipsis" />
                                </DataTemplate>
                            </GridViewColumn.CellTemplate>
                        </GridViewColumn>
                    </GridView>
                </ListView.View>
            </ListView>
            <StackPanel Orientation="Horizontal">
                <RadioButton x:Name="rbAllBook" IsChecked="True" GroupName="Sort" Height="24" Margin="2"
                             FontWeight="Normal" VerticalAlignment="Bottom" Click="HandleRbAllBook" />
                <RadioButton x:Name="rbAllDetail" GroupName="Sort" Height="24" Margin="8,2,2,2" FontWeight="Normal"
                             VerticalAlignment="Bottom" Click="HandleRbAllDetail" />
            </StackPanel>

            <Label x:Name="lbNoteDetail" FontWeight="SemiBold" Foreground="MidnightBlue" BorderBrush="Green"
                   BorderThickness="0,0,0,2" />
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="100" />
                    <ColumnDefinition Width="*" />
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition Height="30" />
                    <RowDefinition Height="30" />
                    <RowDefinition Height="30" />
                    <RowDefinition Height="auto" />
                </Grid.RowDefinitions>
                <Label x:Name="lbBookTitle" FontWeight="SemiBold" Foreground="DarkRed" Grid.Column="0" Grid.Row="0" />
                <Label x:Name="lbPageNo" FontWeight="SemiBold" Foreground="LightSlateGray" Grid.Column="0" Grid.Row="1" />
                <Label x:Name="lbDate" FontWeight="SemiBold" Foreground="RoyalBlue" Grid.Column="0" Grid.Row="2" />
                <Label x:Name="lbDesCription" FontWeight="SemiBold" Grid.Column="0" Grid.Row="3" />

                <Label x:Name="lbBookTitleDt" Grid.Column="1" Grid.Row="0" />
                <Label x:Name="lbPageNoDt" Grid.Column="1" Grid.Row="1" />
                <Label x:Name="lbDateDt" Grid.Row="2" Grid.ColumnSpan="2" Margin="99,0,1,0" />
                <RichTextBox x:Name="txtDescription" Grid.Column="1" Grid.Row="3" Margin="0,6,0,2" MinHeight="120"
                             MaxHeight="120" VerticalScrollBarVisibility="Visible" />
            </Grid>
            <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,4,8,2">
                <Button x:Name="btSave" Background="Transparent" BorderThickness="0" Margin="4"
                        Click="SaveButtonHandler">
                    <Grid>
                        <Image Height="25">
                            <Image.Style>
                                <Style TargetType="{x:Type Image}">
                                    <Setter Property="Source" Value="Image/NoteButton.png" />
                                    <Style.Triggers>
                                        <DataTrigger Binding="{Binding IsMouseOver, ElementName=btSave}" Value="True">
                                            <Setter Property="Source" Value="Image/NoteButtonHover.png" />
                                        </DataTrigger>
                                    </Style.Triggers>
                                </Style>
                            </Image.Style>
                        </Image>
                        <Label x:Name="btSaveName" HorizontalAlignment="Center" />
                    </Grid>
                </Button>
                <Button x:Name="btCancel" Click="CancelButtonHandler" Background="Transparent" BorderThickness="0"
                        Margin="4">
                    <Grid>
                        <Image Height="25">
                            <Image.Style>
                                <Style TargetType="{x:Type Image}">
                                    <Setter Property="Source" Value="Image/NoteButton.png" />
                                    <Style.Triggers>
                                        <DataTrigger Binding="{Binding IsMouseOver, ElementName=btCancel}" Value="True">
                                            <Setter Property="Source" Value="Image/NoteButtonHover.png" />
                                        </DataTrigger>
                                    </Style.Triggers>
                                </Style>
                            </Image.Style>
                        </Image>
                        <Label x:Name="btCancelName" HorizontalAlignment="Center" />
                    </Grid>
                </Button>
            </StackPanel>
        </StackPanel>
    </Border>
</Window>